home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # This is a script to facilitate making a "CD ROM efficient" EAFS
- # filesystem. Given an input directory hierarchy, it produces on standard
- # out a shell script which creates a directory structure framework, with
- # each directory fleshed out to the necessary size. It also has comments
- # showing how to properly initialize the hard disk EAFS filesystem from
- # which the CD ROM image will be dd'd.
- #
- # Hope this is helpful.
- #
- # >Bela<
- #
- #
- # mkcdfs 1.21 94/07/19 belal@sco.com
- #
- # usage: cd /working/directory; mkcdfs > OUTPUT_FILE
- #
- # e.g.: cd /v/wrk/dist; mkcdfs > /tmp/make_dist_tree
- #
- # The output is a shell script which can be run on a *blank* mkfs'd filesystem
- # to create a directory structure which will hopefully be efficient on an EAFS
- # filesystem CD-ROM. The script is run like this:
- #
- # cd /root/of/filesystem/from/which/CD/will/be/dd'd
- # . /tmp/make_dist_tree
- #
- # The filesystem should have been created with
- #
- # mkfs -y -f EAFS /dev/_whatever_ BBBB:IIII 1 2048 -E -C1
- #
- # where BBBB is the size of the filesystem, in 1/2K blocks (use about 5%
- # larger than cpio said) and IIII is the number of inodes (use perhaps
- # 100 more than the total number of files+directories on the filesystem).
- #
- # This is very crude...
-
- echo "Making script to make CD filesystem of `/bin/pwd`" 1>&2
-
- echo 'ROOT_DIR=`pwd`'
- find . -depth -type d -print |
- sed 's-^\./--' | # `sed` to remove leading "./"
- tr '/' '\01' | # `tr` to make sure /etc/abc/def sorts before /etc/abc.def
- sort | # `sort` to make sure dirs processed before their subdirs
- tr '\01' '/' | # `tr` to undo the first `tr`
- while read d; do
- [ "$d" != "." ] && echo 'mkdir $ROOT_DIR/'"$d"
- echo 'cat > /tmp/filelist.$$ << '"'__filelist__EOF'"
- (echo $d/.* $d/* | xargs ls -lLd) 2>/dev/null | awk '/^d/ {next} {print $NF}'
- echo '__filelist__EOF'
- echo 'xargs -n100 touch < /tmp/filelist.$$'
- echo 'cat /tmp/filelist.$$ >> /tmp/cpiolist.$$'
- done
-
- # Output should be redirected somewhere -- this is supposed to be writing
- # a shell script which will be executed later.
-